home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / TextObjects.p < prev    next >
Text File  |  1996-05-01  |  8KB  |  173 lines

  1. {
  2.      File:        TextObjects.p
  3.  
  4.      Contains:    Text object Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT TextObjects;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __TEXTOBJECTS__}
  28. {$SETC __TEXTOBJECTS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC TextObjectsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __UNICODE__}
  41. {$I Unicode.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __TEXTCOMMON__}
  44. {$I TextCommon.p}
  45. {$ENDC}
  46.  
  47. {$PUSH}
  48. {$ALIGN MAC68K}
  49. {$LibExport+}
  50.  
  51. {$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
  52. {  Basic data types  }
  53.  
  54. TYPE
  55.     TextObjectUnit                        = UInt32;
  56.     TextObject                            = ^TextObjectUnit;
  57.     TextObjectPtr                        = ^TextObject;
  58.     ConstTextObject                        = ^TextObjectUnit;
  59. {  Indices into text objects  }
  60.     TextObjectIndex                        = UInt32;
  61.  
  62. CONST
  63.     kTextObjectStart            = 0;
  64.     kTextObjectEnd                = $FFFFFFFF;
  65.  
  66. {  Option flags  }
  67.  
  68. TYPE
  69.     TextObjectOptions                    = OptionBits;
  70. {
  71.  The default or standard OptionBits are all zero by convention. The following
  72.    symbolic constant is provided for code readability. 
  73. }
  74.  
  75. CONST
  76.     kTextObjStandardOptions        = 0;
  77.  
  78.     kTextObjNormalizeOptBit        = 0;
  79.  
  80.     kTextObjDontNormalizeOpt    = $00;
  81.     kTextObjNormalizeOpt        = $01;
  82.  
  83. {  Creation and destruction  }
  84. FUNCTION NewTextObject(VAR newTextObject: TextObject): OSStatus; C;
  85. FUNCTION InitPersistentTextObject(VAR textObjectSpace: TextObjectUnit; sizeInBytes: ByteCount): OSStatus; C;
  86. FUNCTION DisposeTextObject(textObject: TextObject): OSStatus; C;
  87. FUNCTION CreateTextObjectFromTextObject(oldTextObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; VAR newTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C;
  88. {  Text content manipulation  }
  89. FUNCTION InstallTextIntoTextObject(srcText: ConstCStringPtr; srcLengthInBytes: ByteCount; srcEncoding: TextEncoding; language: LocaleIdentifier; destTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C;
  90. FUNCTION AppendTextToTextObject(srcText: ConstCStringPtr; srcLengthInBytes: ByteCount; srcEncoding: TextEncoding; language: LocaleIdentifier; destTextObject: TextObject; optionBits: TextObjectOptions): OSStatus; C;
  91. FUNCTION ExtractTextFromTextObject(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; destText: CStringPtr; destMaxSizeInBytes: ByteCount; destEncoding: TextEncoding; VAR language: LocaleIdentifier; VAR destSizeInBytes: ByteCount; VAR nextSrcIndex: TextObjectIndex): OSStatus; C;
  92. FUNCTION ReplaceInTextObject(destText: TextObject; destStartIndex: TextObjectIndex; destEndIndex: TextObjectIndex; srcText: ConstTextObject; srcStartIndex: TextObjectIndex; srcEndIndex: TextObjectIndex; VAR newStartIndex: TextObjectIndex; VAR newEndIndex: TextObjectIndex): OSStatus; C;
  93. {  Text object information  }
  94. FUNCTION IsPersistentTextObject(textObject: ConstTextObject): BOOLEAN; C;
  95. FUNCTION IsTextObjectEmpty(textObject: ConstTextObject): BOOLEAN; C;
  96. FUNCTION GetTextObjectSize(textObject: ConstTextObject): ByteCount; C;
  97. FUNCTION GetTextObjectMaxSize(textObject: ConstTextObject): ByteCount; C;
  98. FUNCTION GetTextObjectEndIndex(textObject: ConstTextObject): TextObjectIndex; C;
  99. FUNCTION ComputePersistentTextObjectSize(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; optionBits: TextObjectOptions): ByteCount; C;
  100. FUNCTION ComputePersistentTextObjectFromTextSize(text: ConstCStringPtr; textByteLength: ByteCount; textEncoding: TextEncoding; language: LocaleIdentifier; optionBits: TextObjectOptions): ByteCount; C;
  101. FUNCTION ComputeTextObjectExtractedTextSize(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; destMaxSizeInBytes: ByteCount; destEncoding: TextEncoding; VAR language: LocaleIdentifier; VAR destResultLengthInBytes: ByteCount; VAR nextSrcIndex: TextObjectIndex): OSStatus; C;
  102. FUNCTION GetTextObjectTextTags(textObject: ConstTextObject; index: TextObjectIndex; VAR encoding: TextEncoding; VAR language: LocaleIdentifier): OSStatus; C;
  103. {  This is equivalent to the preceding function. The preceding name is preferred.  }
  104. FUNCTION GetTextObjectEncodingAndLocaleIdentifier(textObject: ConstTextObject; index: TextObjectIndex; VAR encoding: TextEncoding; VAR language: LocaleIdentifier): OSStatus; C;
  105. {  Bulk access to text content  }
  106.  
  107. TYPE
  108.     TextObjectTextInfoPtr = ^TextObjectTextInfo;
  109.     TextObjectTextInfo = RECORD
  110.         encoding:                TextEncoding;
  111.         language:                LocaleIdentifier;
  112.         startIndex:                TextObjectIndex;
  113.         endIndex:                TextObjectIndex;
  114.         textLength:                ByteCount;
  115.         text:                    ConstCStringPtr;
  116.     END;
  117.  
  118. FUNCTION CountTextObjectTextRuns(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; VAR numTextRuns: ItemCount): OSStatus; C;
  119. FUNCTION GetTextObjectTextRuns(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; runArraySize: ItemCount; VAR runInfo: TextObjectTextInfo; VAR actualNumTextRuns: ItemCount): OSStatus; C;
  120. {  Comparison functions are in TextUtils  }
  121. {  Annotations  }
  122. {  Annotation types are given by the traditional four-character codes  }
  123.  
  124. TYPE
  125.     TextObjectAnnotationTag                = FourCharCode;
  126. {  A wildcard tag to specify all annotations  }
  127.  
  128. CONST
  129.     kTextObjAnyAnnotationType    = '****';
  130.  
  131. {  Annotation attributes  }
  132.  
  133. TYPE
  134.     TextObjectAnnotationAttributes        = OptionBits;
  135. {  Annotation attribute bits  }
  136.  
  137. CONST
  138.     kTextObjAnnotationChangedMask = $01;
  139.     kTextObjTextChangedMask        = $02;
  140.  
  141. FUNCTION AnnotateTextObject(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; dataLength: ByteCount; data: UNIV Ptr; annotationOptions: TextObjectAnnotationAttributes): OSStatus; C;
  142. FUNCTION DeleteTextObjectAnnotations(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag): OSStatus; C;
  143. {  Accessing annotations  }
  144.  
  145. TYPE
  146.     TextObjectAnnotationInfoPtr = ^TextObjectAnnotationInfo;
  147.     TextObjectAnnotationInfo = RECORD
  148.         annotationType:            TextObjectAnnotationTag;
  149.         rangeStart:                TextObjectIndex;
  150.         rangeEnd:                TextObjectIndex;
  151.         attributes:                TextObjectAnnotationAttributes;
  152.         dataSize:                ByteCount;
  153.         data:                    Ptr;
  154.     END;
  155.  
  156. FUNCTION CountTextObjectAnnotations(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; VAR numAnnotations: ItemCount): OSStatus; C;
  157. FUNCTION GetTextObjectAnnotations(textObject: ConstTextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; infoArraySize: ItemCount; VAR annotationInfo: TextObjectAnnotationInfo; VAR actualNumAnnotations: ItemCount): OSStatus; C;
  158. FUNCTION SetAnnotationAttributes(textObject: TextObject; startIndex: TextObjectIndex; endIndex: TextObjectIndex; annotationType: TextObjectAnnotationTag; annotationOptions: TextObjectAnnotationAttributes): OSStatus; C;
  159. {  Miscellaneous  }
  160. FUNCTION VerifyTextObject(textObject: ConstTextObject): OSStatus; C;
  161. FUNCTION NormalizeTextObject(textObject: TextObject): OSStatus; C;
  162. {$ENDC}
  163. {$ALIGN RESET}
  164. {$POP}
  165.  
  166. {$SETC UsingIncludes := TextObjectsIncludes}
  167.  
  168. {$ENDC} {__TEXTOBJECTS__}
  169.  
  170. {$IFC NOT UsingIncludes}
  171.  END.
  172. {$ENDC}
  173.